//  Created by Sam Deane on 29/11/2016.
//  Copyright © 2016 Bohemian Coding. All rights reserved.
//

NS_ASSUME_NONNULL_BEGIN

/**
 Ultimately this class is intended to be a higher level version of NSURLSession, which provides simple support for downloading and uploading
 files to/from various sources, resuming interrupted downloads, etc.
 
 For now though it serves a single purpose, which is to provide a replacement for NSURLConnection's sendSynchronousRequest, which was deprecated in 10.11.
 */

@interface BCNetworkManager : NSObject

/**
 Performs a synchronous load of the given request,
 returning an NSURLResponse in the given out
 parameter.

 @discussion
 A synchronous load for the given request is built on
 top of the asynchronous loading code made available
 by NSURLSession. This method is provided for backwards
 compatibility only, and we should try to move away from it
 towards fully asynchronous solutions.

 @param
 request   The request to load.

 @param
 response  An out parameter which is filled in with the
 response generated by performing the load.

 @param
 error     Out parameter (may be NULL) used if an error occurs
 while processing the request. Will not be modified if the
 load succeeds.

 @result      The content of the URL resulting from performing the load,
 or nil if the load failed.
 */


+ (nullable NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse * _Nullable * _Nullable)response error:(NSError **)error;

@end

NS_ASSUME_NONNULL_END
